package misBS::Controller::Login;

use strict;
use warnings;
use base 'Catalyst::Controller';

=head1 NAME

misBS::Controller::Login - Catalyst Controller

=head1 DESCRIPTION

Catalyst Controller.

=head1 METHODS

=cut


=head2 index 

=cut

sub index : Private {
    my ( $self, $c ) = @_;
	
    my $username=$c->request->params->{username} || "";
	my $password=$c->request->params->{password} || "";

	if ($username && $password){
		if ($c->login($username,$password)){
			$c->response->redirect($c->uri_for('/Menus'));
			return;
		} else {
			$c->stash->{error_msg}="Bad username or password";
		}
	}

	$c->stash->{template}='login.tt2';
}


=head1 AUTHOR

alabos,,,

=head1 LICENSE

This library is free software, you can redistribute it and/or modify
it under the same terms as Perl itself.

=cut

1;
